<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="../angular.js"></script>
	</head>

	<body ng-app="myApp">
		<div ng-controller="MyController">
			<h1>Time:{{ clock.time | date:'yyyy-mm-dd hh:mm:ss' }}</h1>
		</div>
		<script type="text/javascript">
			var app = angular.module("myApp", []);
			app.controller("MyController", function($scope, $timeout) {
				//对象
				$scope.clock = {
					time: new Date()
				};
				//方法更新引用
				var updateClock = function() {
					$scope.clock.time = new Date();
				}
				//定时器操作
				setInterval(function() {
					$scope.$apply(updateClock);
				}, 1000);
			});
		</script>
	</body>

</html>